package kadledav.backend.model;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import kadledav.backend.dto.NewsDTO;

import org.springframework.beans.BeanUtils;

@Entity
public class News extends AbstractBO {

	/**
	 * 
	 */
	private static final long serialVersionUID = 9044819162787664169L;

	String message;

	Date created;

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public NewsDTO toDTO() {
		NewsDTO newsDTO = new NewsDTO();
		BeanUtils.copyProperties(this, newsDTO);
		return newsDTO;
	}

	public void fromDTO(NewsDTO newsDTO) {
		BeanUtils.copyProperties(newsDTO, this);
	}

	@Temporal(TemporalType.TIMESTAMP)
	public Date getCreated() {
		return created;
	}

	public void setCreated(Date created) {
		this.created = created;
	}

}
